package com.lurencun.android.topicbank.entity;

import com.lurencun.android.topicbank.presist.Answer;


public class AnswerJsonEntity {

	/** 问题ID **/
	private Long answerId;
	 
	private String content;
	
	private String correct;

	public Long getAnswerId() {
		return answerId;
	}

	public void setAnswerId(Long answerId) {
		this.answerId = answerId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getCorrect() {
		return correct;
	}

	public void setCorrect(String correct) {
		this.correct = correct;
	}

	public Answer transform() {
		Answer answer = new Answer();
		answer.setAnswerId(answerId);
		answer.setContent(content);
		if (correct!=null) {
			answer.setCorrect(correct.equals("1"));
		}
		else {
			answer.setCorrect(false);	
		}
		
		return answer;
	}

	public boolean isValid() {
		return this.answerId!=null && this.answerId > 0 && this.content!=null && !this.content.equals("");
	}
	
	
}
